/*
 * iVprog : http://www.matematica.br/ivprog
 * 
 * @description Image to "about window" (from 'edu/cmu/cs/stage3/alice/authoringtool/images/aboutIVprog.png')
 * 
 */

package edu.cmu.cs.stage3.alice.authoringtool.dialog;

import edu.cmu.cs.stage3.resourceBundle.I18n;

import javax.swing.ImageIcon;

import edu.cmu.cs.stage3.swing.ContentPane;

public class AboutContentPane extends ContentPane {

  private javax.swing.JButton m_okButton = new javax.swing.JButton(I18n.getString("buttonOK")); // "OK"
  private static final int dimX=300, dimY=200;

  private static final String str_image_about = "images/aboutIVprog.png"; // aboutAlice.jpg

  public AboutContentPane ()  {
    javax.swing.JLabel imageLabel = new javax.swing.JLabel();
    // imageLabel.setIcon(new ImageIcon(edu.cmu.cs.stage3.alice.authoringtool.JAlice.class.getResource(str_image_about)));
    try {
      imageLabel.setIcon(new ImageIcon(edu.cmu.cs.stage3.alice.authoringtool.JAlice.class.getResource(str_image_about)));
      // Object obj = edu.cmu.cs.stage3.alice.authoringtool.JAlice.class.getResource(str_image_about);
      // imageLabel.setIcon(new ImageIcon(obj));
    } catch (Exception e) {
      String str = str_image_about+" : "+edu.cmu.cs.stage3.alice.authoringtool.JAlice.class.getResource(str_image_about);
      System.err.println("Error: AboutContentPane.java: "+str+": "+e.toString());
      return;
      }

    setPreferredSize( new java.awt.Dimension(dimX, dimY) );

    setLayout( new java.awt.GridBagLayout() );
    java.awt.GridBagConstraints gbc = new java.awt.GridBagConstraints();
    gbc.gridwidth = java.awt.GridBagConstraints.REMAINDER;
    add( imageLabel, gbc );
    add( m_okButton, gbc );
    }

  //Rem @Override
  public String getTitle () {
    return "";
    }

  //Rem @Override
  public void addOKActionListener (java.awt.event.ActionListener l) {
    m_okButton.addActionListener(l);
    }

  //Rem @Override
  public void removeOKActionListener (java.awt.event.ActionListener l) {
    m_okButton.removeActionListener(l);
    }

  // public void paint (java.awt.Graphics g) { // paintComponent
  public void paintComponent (java.awt.Graphics g) { //
    super.paintComponent( g );
    // java.awt.Rectangle bounds = getBounds();
    String str = "iVprog version: " + edu.cmu.cs.stage3.alice.authoringtool.JAlice.version;
    int dimW = this.getWidth();
    g.setColor( java.awt.Color.black );
    g.drawString( str, dimW-140, 15 );
    }	
	
  }
